--- This is an undocumented module
module tests.qc.Wrappers where

import frege.test.QuickCheck public
import Data.Monoid
import Data.wrapper.Boolean
import Data.wrapper.Dual
import Data.wrapper.Num

prop_any_empty_right = property (\b ->
            Any b <> mempty == Any b)
prop_any_empty_left = property (\b ->
            mempty <> Any b == Any b)
prop_any_disjunction = 
        forAll arbitrary (\a -> 
            forAll arbitrary (\b ->
                Any (a `oder` b) == Any a <> Any b))

prop_all_empty_right = property (\b ->
            All b <> mempty == All b)
prop_all_empty_left = property (\b ->
            mempty <> All b  == All b)            
prop_all_conjunction = 
        forAll arbitrary (\a ->
            forAll arbitrary (\b ->
                (a `und` b) == getAll (All a <> All b)))

prop_dual = property rev where
    rev x = (Dual x <> Dual y) == Dual (y <> x)
    y = "reversed"


prop_prod_left = 
    forAll arbitrary (\a ->
        mempty <> Product a == Product (1*a))
prop_prod_right =
    forAll arbitrary (\a ->
        Product a <> mempty == Product (a*1))
prop_prod_prod = 
    forAll arbitrary (\(a::Float) ->
        forAll arbitrary (\b ->
            Product a <> Product b == Product (a*b))) 

prop_sum_left = 
    forAll arbitrary (\a ->
        mempty <> Sum a == Sum (0+a))
prop_sum_right =
    forAll arbitrary (\a ->
        Sum a <> mempty == Sum (a+0))
prop_sum_sum = 
    forAll arbitrary (\(a::Float) ->
        forAll arbitrary (\b ->
            Sum a <> Sum b == Sum (a+b)))
